package card.context;

/**
 * @description: 基础参数容器
 * @author: ly
 * @date: 2020/8/24 17:25
 */
public class BaseContext {
    public static ThreadLocal<PlatformContext> threadLocal = new ThreadLocal<>();

    public static void setContext(PlatformContext context) {
        threadLocal.set(context);
    }

    public static PlatformContext getContext() {
        return threadLocal.get();
    }

    /**
     * 移除context
     */
    public static void remove() {
        threadLocal.remove();
    }

    /**
     * 初始化context
     */
    public static void init() {
        threadLocal.remove();
        setContext(new PlatformContext());
    }
}
